<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Expires" CONTENT="0">
<meta http-equiv="Cache-Control" CONTENT="no-cache">
<meta http-equiv="Pragma" CONTENT="no-cache">
<meta content="telephone=no" name="format-detection" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no">
<title>泸州市娱乐业信息管理系统</title>
<link type="text/css" rel="stylesheet" href="resource/fapiao.css">
<link rel="stylesheet" href="resource/weuimin.css" />
<link rel="stylesheet" href="resource/example.css" />
<script type="text/javascript" src="resource/jweixin1002.js"></script>
<script type="text/javascript" src="script/common.js"></script>
<script type="text/javascript" src="resource/jweixin1.js"></script>
<script type="text/javascript" src="resource/jquery1.js"></script>
<script type="text/javascript" src="resource/qrcode.js"></script>
<script type="text/javascript" src="resource/jquerybarcode.js"></script>
<script type="text/javascript" src="template/js/jquery.js"></script>
<script type="text/javascript" src="resource/my.js"></script>
<link type="text/css" rel="stylesheet" href="resource/jinsuistyle.css" />
<script src="../../script/api.js"></script>
<style>
.nav{
	padding: 10px 2%;
}
.bg {
    padding: 15px 0 15px;
}
.weui-grid{width:50%;}
.weui-grid__icon{width: 50px;height: 50px;}
.isnew{background: #FFFFFF url('template/images/xp4.png') no-repeat 100% 0px ;}

            input::-webkit-input-placeholder {
                color: #ccc;
            }
            
           .loginbg {
                width: 100%;
            }
            
            
            .divider {
                height: 0px  
            }
  
   /*         登录条与上面图片的高度（间距）*/
            .user,
            .passwd {

                background: #1fff;

            }
            
            .passwd img,
            .user img {
                vertical-align: top;
            }
            
            .item {
                background-color: #fff;
                border-bottom: 2px solid #e0e0e0;
                position: relative;
                height: 40px;
                font-size: 20px;
            }
            
            .btn {
                margin: 3px 10px;
                background: #2C9CDC;
                height: 40px;
                line-height: 40px;
                text-align: center;
                font-size: 20px;
                margin-top: 20px;
                border-radius: 5px;
                color: #fff;
            }
            
            .user img {
                width: 25px;
                margin-top: 5px;
                margin-left: 50px;
                margin-right: 10px;
            }
            
            .passwd img {   /* 密码中图片框*/
                height: 25px;      /*  高度*/
                margin-top: 5px;   /* 上边距*/
                margin-left: 50px;   /*左边距*/
                margin-right: 10px;  /*右边距*/
            }
            
            .bottom {
                position: absolute;
                left: 0px;
                bottom: 0px;
                width: 100%;
                text-align: center;
                font-size: 12px;
            }
            
            .bottom img {
                height: 50px;
            }
            
            .bottom .arrow {
                text-align: center;
                margin: 10px 0;
            }
            
            .bottom .arrow img {
                width: 40px;
                height: 20px;
            }
            
            #qqpic {
                margin-right: 10px;
                margin-left: 10px;
            }
            
            .thirdinfo {
                color: #666;
                margin-top: 10px;
            }
            
            .thirdcompy .left {
                margin-right: 20px;
            }
            
            .thirdcompy .left,
            .thirdcompy .right {
                width: 40%;
                display: inline-block;
                background: #fff;
                border: 1px solid #e0e0e0;
                border-radius: 4px;
                vertical-align: top;
                text-align: left;
                font-size: 18px;
            }
            
            .thirdcompy .left img,
            .thirdcompy .right img {
                width: 30px;
                height: 30px;
                float: left;
                margin: 5px 10px;
            }
            
            .thirdcompy span {
                line-height: 40px;
                color: #666;
            }
            
            .loginmore {
                margin-top: 10px;
            }
            
            .loginmore span {
                color: #0078ff;
            }
            
            .loginmore .forget {
                margin-left: 10px;
            }
            
            .loginmore .phone {
                margin-right: 10px;
                float: right;
            }
            
            .btnhover {
                background-color: #dcdcdc !important;
            }
            
            .buyhover {
                background-color: rgba(252, 85, 0, 0.6) !important;
            }
            
            .presshover {
                background-color: #FAFAFA !important;
            }
            
            .txthover {
                color: rgba(0, 120, 255, 0.6) !important;
            }
            
            input {
                outline: none;
            }
#jsheader_absolute {
    /* Webkit (Safari/Chrome 10) */
    background-color: #18B4ED;
}
#jsnav{
    display:-webkit-box;
    height:44px;
}
#jsleft {
    width:80px;
    color:#fff;
    background:url(image/navbtnback.png) no-repeat 14px 0;
    -webkit-background-size:10px 15px;
}
#jsmiddle {
    -webkit-box-flex:1;
    width:100%;
    display:-webkit-box;
    -webkit-box-pack:center;
    -webkit-box-align:center;
}
#jstitle {
    font-size:18px;
    text-align:center;
    color:#fff;
}
#jsright {
    width:80px;
}
#jsleft>span {
    margin-top:13px;
    margin-left:36px;
    font-size:18px;
    height:44px;
    line-height:44px;
    color: #fff;
}
</style>

<body>
  <header id="statusBar">
	<div id="jsheader_absolute">
			<nav id="jsnav">
					<a id="jsleft" tapmode="" onclick="api.closeWin();">
							<span>主页</span> 
					</a>
					<div id="jsmiddle">
							<strong id="jstitle">泸州市娱乐业信息管理系统</strong>
					</div>
					<a id="jsright">
						<!-- <span></span> -->
					</a>
			</nav>
	</div>
	</header>
<img src="image/personalbkgzhuye.png" class="loginbg">

        <section class="divider"></section>
        <section>
            <div class="item user">
                <img src="image/login01.png">
                <input type="text" placeholder="用户" id="user">
            </div>
            <div class="item passwd">
                <img src="image/login02.png">
                <input type="password" placeholder="密码" id="password">
            </div>
            <div class="btn" tapmode onclick="Login();">登 录</div>
           
        </section>

    <script type="text/javascript">


  apiready = function () {
   if(api.systemType == "ios"){
	   document.getElementById("statusBar").style.background = "#298cb4";
	}
   $api.fixStatusBar( $api.dom('header') );
   if($api.getStorage('loginname')!=null){   //取得登录名
    document.getElementById("user").value = $api.getStorage('loginname');
    }
//       }else{

//      var lgName = api.getPrefs({
//              sync: true,
//             key: 'LGNAME'
//           });
//     	if(lgName!=null){
//	        document.getElementById("user").value = lgName;
//	       }

//       var fs = api.require('fs');
//       
//          fs.open({                //打开文件
//              path: 'widget://lgname.txt',
//             flags: 'read_write'
//           }, function(ret, err) {
//          if (ret.status) {       //如果打开文件成功
//          				    fs.read({       //读文件
//          				    fd: ret.fd,
//          				    offset: 0,
//          				    length: 0
//                               }, function(ret, err) {
//                  
//				                   if (ret.status) {
//				  				         api.alert({
//								          title: 'OK',
//								          msg: ret.data
//								      });
//				                    }
//          
//                    });
//              } 
//              
//              
//           });
   
//        }//end  有无Storage内容
//    $api.clearStorage ();            //首次进入就清空保存的信息

  //  $api.rmStorage('loginname', ret.LOGINNAME);    //保存数据到。。
      $api.rmStorage('name');  
      $api.rmStorage('sf'); 
      $api.rmStorage('dwid');
      $api.rmStorage('dw_name');
      $api.rmStorage('jc'); 
      $api.rmStorage('dw_code'); 
      $api.rmStorage('dw_sf'); 
      $api.rmStorage('id');                //登录人员ID
      $api.rmStorage('dw_sj');             //登录人员ID    



 }





function Login(){

  var username=$api.byId('user').value;              
  var password=$api.byId('password').value;

   username=$api.trim(username); //去掉前后空格
  // username=$api.trimAll(username); //去掉所有空格
   
   if(username==''){
   api.alert({
          title: '错误：',
          msg: '用户名不能为空!'
      });
    }

    else if(password==''){
   api.alert({
          title: '错误：',
          msg: '密码不能为空!'
          
      });

   }
  else{
		  api.ajax({ 
		      url: Serverip + '/base/syuser!doNotNeedSessionAndSecurity_MobileLogin.sy?user='+username+'&password='+password,
		      method: 'get',
		      cache: false,
		      timeout: 30,
		      dataType: 'json'
		  }, function(ret, err){
		  
		 if(ret && ret.ID) {
                
               if(ret.DW_ZF!='0'){
                      api.alert({
			          title: '登录失败！',
			          msg:   '场所单位已经注销，请联系单位管理员！'
			         });
                 return ;
                }

                if(ret.IS_LEAVE!='0'){
                      api.alert({
			          title: '登录失败！',
			          msg:   '用户已经注销，请联系单位管理员！'
	
			         });
                  return ;
                }
            
                  
//                api.setPrefs({
//					    key: 'LGNAME',
//					    value: ret.LOGINNAME
//					});
//                
                  
                  $api.setStorage('loginname', ret.LOGINNAME);    //保存数据到。。
                  $api.setStorage('name', ret.NAME);  
                  $api.setStorage('sf', ret.SF); 
                  $api.setStorage('dwid', ret.DWID);
                  $api.setStorage('dw_name', ret.DW_NAME);
                  $api.setStorage('jc', ret.JC); 
                  $api.setStorage('dw_code', ret.DW_CODE); 
                  $api.setStorage('dw_sf', ret.DW_SF); 
                  $api.setStorage('id', ret.ID);                //登录人员ID
                  $api.setStorage('dw_sj', ret.DW_SJ);          //登录人员ID                 
                  
                  
                 if(password=='123456'){          //如果是初始密码是123456,就提示要修改并进入修改页面
                     api.alert({
			          title: '提示：',
			          msg:   '您的密码为初始密码，为了您的账号安全，请修改！'
			           });
	              location.href='./html/allmmxg.html';
	              return ;
                 }  
		

				  switch(ret.SF){           
				 //根据身份不同（0 公安管理员，1是公安民警  2场所管理员   3是场所操作员     9 系统管理员），进入不同页面
	              case '0': 
		                  location.href='./html/guser.html';
	 	                  break;   
	 	                  
	              case '1':
		                  location.href='./html/guser.html';
		                 break; 
		                 
		          case '2':
		                  location.href='./html/cadmin.html';
		                 break;  
		
				  case '3':
		                  location.href='./html/cuser.html';
		                 break;  
		                 
		          case '9':
		                  location.href='./html/tadmin.html';
		                 break;      
		                 
		                }
		

		
		
		
		      }else{
		      //  var msg = JSON.stringify(err);
			      api.alert({
			          title: '登录失败！',
			          msg:   '用户或密码错！'
			         });
		       }
		      
		     //  api.closeWin();
		  });
     }
        
   }    
    </script>
		
	<div class="page__ft">
	            <p><a style="color:#777;font-size:12px"  onclick="alert(api.deviceId)">泸州市公安局</a></p>
		 		<p><a style="color:#777;font-size:12px;" onclick="alert(api.deviceId)">四川航天信息有限公司</a><b id="bbb"></b></p>
				</div>

</body>
</html>
